package com.zxy.ziems.server.file.enums;

import java.util.function.Function;

/**
 * @author chdzq
 * @create 2023/3/21
 */
public enum MineTypeEnum {
    JPEG(FileTypeEnum.IMAGE.getValue(), "FFD8FF"),
    PNG(FileTypeEnum.IMAGE.getValue(), "89504E47"),
    GIF(FileTypeEnum.IMAGE.getValue(), "47494638"),
    TIFF(FileTypeEnum.IMAGE.getValue(), "49492A00"),
    BMP(FileTypeEnum.IMAGE.getValue(), "424D"),
    DWG(FileTypeEnum.IMAGE.getValue(), "41433130"),
    PSD(FileTypeEnum.IMAGE.getValue(), "38425053"),
    RTF(FileTypeEnum.DOC.getValue(), "7B5C727466"),
    XML(FileTypeEnum.DOC.getValue(), "3C3F786D6C"),
    HTML(FileTypeEnum.DOC.getValue(), "68746D6C3E"),
    XLS_DOC(FileTypeEnum.DOC.getValue(), "D0CF11E0"),
    XLSX_DOCX(FileTypeEnum.DOC.getValue(), "504B030414000600080000002100"),
    VSD(FileTypeEnum.DOC.getValue(), "d0cf11e0a1b11ae10000"),
    MDB(FileTypeEnum.DOC.getValue(), "5374616E64617264204A"),
    WPS(FileTypeEnum.DOC.getValue(), "d0cf11e0a1b11ae10000"),
    TORRENT(FileTypeEnum.DOC.getValue(), "6431303A637265617465"),
    WPD(FileTypeEnum.DOC.getValue(), "FF575043"),
    EPS(FileTypeEnum.DOC.getValue(), "252150532D41646F6265"),
    PDF(FileTypeEnum.DOC.getValue(), "255044462D312E"),
    WAV(FileTypeEnum.AUDIO.getValue(), "57415645"),
    AVI(FileTypeEnum.AUDIO.getValue(), "41564920"),
    RAM(FileTypeEnum.VIDEO.getValue(), "2E7261FD"),
    RM(FileTypeEnum.VIDEO.getValue(), "2E524D46"),
    MPG(FileTypeEnum.VIDEO.getValue(), "000001BA"),
    MOV(FileTypeEnum.VIDEO.getValue(), "6D6F6F76"),
    ASF(FileTypeEnum.VIDEO.getValue(), "3026B2758E66CF11"),
    MID(FileTypeEnum.VIDEO.getValue(), "4D546864"),
    MP4(FileTypeEnum.VIDEO.getValue(), "00000020667479706d70"),
    MP3(FileTypeEnum.VIDEO.getValue(), "49443303000000002176"),
    FLV(FileTypeEnum.VIDEO.getValue(), "464C5601050000000900");

    private String key;
    private String value;
    public static Function<String, String> getKeys = (v) -> {
        String result = FileTypeEnum.OTHER.getValue();
        MineTypeEnum[] var2 = values();
        int var3 = var2.length;

        for(int var4 = 0; var4 < var3; ++var4) {
            MineTypeEnum type = var2[var4];
            if (v.startsWith(type.value)) {
                result = type.key;
                break;
            }
        }

        return result;
    };

    private MineTypeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return this.key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return this.value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}

